Skip to content

fix: resolve import backup silently failing due to deactivated widget context#113

Open
ivanwongtf wants to merge 1 commit into
LeanBitLab:masterfrom
ivanwongtf:fix/import-backup-v2
Open

fix: resolve import backup silently failing due to deactivated widget context#113
ivanwongtf wants to merge 1 commit into
LeanBitLab:masterfrom
ivanwongtf:fix/import-backup-v2

Conversation

@ivanwongtf

Copy link
Copy Markdown

Fixes #111

Problem

In _confirmFileImport(), after the user clicks Import:

  1. Navigator.of(dialogContext).pop() closes the confirmation dialog
  2. _import(context, ...) is called with the now-deactivated parent context
  3. context.read<BackupService>() throws "Looking up a deactivated widget's ancestor is unsafe"
  4. Since _import() was not awaited, the error was silently swallowed

Fix

Read service providers before showing the dialog while the context is still valid, then call importBackup() directly without relying on the widget context.

Changes

  • lib/widgets/settings/backup_restore_page.dart: read services before dialog, call importBackup() directly, remove the _import() helper

Testing

Verified on Samsung SM-F946U (Android 16) with 188 apps across 13 categories — import now works correctly.

… context

The _import() function was called with a context that becomes
deactivated when the confirmation dialog is popped, causing
context.read<BackupService>() to throw an unsafe ancestor lookup
error. The error was silently swallowed because _import() was
not awaited.

Fix: read service providers before showing the dialog while the
context is still valid, then call importBackup directly without
relying on the widget context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import Backup silently fails due to deactivated widget context

1 participant